﻿#include <stdio.h>
#include <string.h>

int calculateStrength(char password[]) {
    int length = strlen(password);
    int score = 0;

    // 基础分
    if (length == 0) {
        score = 0;
        return score;
    }
    else {
        score++;
    }

    // 加分项 1
    if (length > 8) {
        score++;
    }

    int upperCase = 0, lowerCase = 0, digit = 0, specialChar = 0;
    for (int i = 0; i < length; i++) {
        if (password[i] >= 'A' && password[i] <= 'Z') {
            upperCase = 1;
        }
        else if (password[i] >= 'a' && password[i] <= 'z') {
            lowerCase = 1;
        }
        else if (password[i] >= '0' && password[i] <= '9') {
            digit = 1;
        }
        else {
            specialChar = 1;
        }
    }

    int typeCount = upperCase + lowerCase + digit + specialChar;
    if (typeCount >= 2) {
        score++;
    }
    if (typeCount >= 3) {
        score++;
    }
    if (typeCount == 4) {
        score++;
    }

    return score;
}

int main() {
    char password[51];
    fgets(password, 51, stdin);
    password[strcspn(password, "\n")] = '\0'; 

    int strength = calculateStrength(password);
    printf("%d\n", strength);

    return 0;
}